home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / drdobbs / 1987 / 11 / letters.exp < prev    next >
Text File  |  1987-10-08  |  3KB  |  85 lines

  1.            moveq.1 #10,d1       if < 10, simple byte move is faster
  2.            cmp.1   d1,d0
  3.            blt.s   tinymove
  4.            move.w  a0,d1
  5.            add.w   a1,d1
  6.            1sr.b   #1,d1        is one address odd and the other even?
  7.            bcs.s   bytemov      if so, cannot use long moves
  8.            asr.1   #1,d0        convert byte count to word count
  9.            move.w  a0,d1
  10.            roxr.w  #1,d1        bit 15 set on odd count, clear on even
  11.            bcc.s   wordmov      even addresses, go!
  12.            eori.w  #$8000,d1    odd addresses, make odd count even & even odd
  13.            bpl.s   align          was byte count originally even?
  14.            subq.1  #1,d0          if so, must fix word count
  15. alin       move.b  (a0)+,(a1)+    now fix odd byte
  16. wordmove   ars.1   #1d0         convert word count to long word count
  17.            bcc.s   longmov      any odd byte has been moved
  18.            move.w  (a0)+,(a1)+  move extra word
  19. longmov    asr.1   #1,d0
  20.            bcc.s   lng2mov
  21.            move.1  (a0)+,(a1)+
  22. lng2mov    asr.1   #1,d0
  23.            bcc.s   lng4mov
  24.            move.1  (a0)+,(a1)+
  25.            move.1  (a0)+,(a1)+
  26. lng4mov    ars.1   #1,d0
  27.            bcs.s   hack
  28.            beq.s   chkodd
  29.            subq.1  #1,d0
  30. quikmov    move.1  (a0)+,(a1)+
  31.            move.1  (a0)+,(a1)+
  32.            move.1  (a0)+,(a1)+
  33.            move.1  (a0)+,(a1)+
  34. hack       move.1  (a0)+,(a1)+
  35.            move.1  (a0)+,(a1)+
  36.            move.1  (a0)+,(a1)+
  37.            move.1  (a0)+,(a1)+
  38.            dbf     d0,quikmov
  39. chkodd     move.w  d1,d1
  40.            bpl.s   exit
  41.            move.1  (a0)+,(a1)+
  42. exit       rts
  43. bytemov    asr.1   #1,d0
  44.            bcc.s   byt2mov
  45.            move.b  (a0)+,(a1)+
  46. byt2mov    asr.1   #1,d0
  47.            bcc.s   byt4mov
  48.            move.b  (a0)+,(a1)+
  49.            move.b  (a0)+,(a1)+
  50. byt4mov    asr.1   #1,d0
  51.            bcs.s   hack2
  52.            subq.1  #1,d0        do not need beq here since count always > 8
  53. byt8mov    move.b  (a0)+,(a1)+
  54.            move.b  (a0)+,(a1)+
  55.            move.b  (a0)+,(a1)+
  56.            move.b  (a0)+,(a1)+
  57. hack2      move.b  (a0)+,(a1)+
  58.            move.b  (a0)+,(a1)+
  59.            move.b  (a0)+,(a1)+
  60.            move.b  (a0)+,(a1)+
  61.            dbf     d0,byt8mov
  62.            rts
  63. loop       move.b  (a0)+,(a1)+
  64. tinymov    dbf     d0,loop
  65.            rts
  66.             
  67. Example 1
  68.  
  69.  
  70.  
  71.  
  72. top: in_regs.h.ah=0; key_code=int86(0\sc29\16,&in_regs,&out_regs);
  73.      in_regs.h.ah=2; kb_status=int86(0\sc29\16,&in_regs,&out_regs);
  74.      kb_status &=O\sc29\00FF; /* to get AL.*/
  75.      ins_flag=kb_statuts & 0\sc29\80;
  76.      cap_flag=kb_statuts & 0\sc29\40;
  77.      num_flag=kb_statuts & 0\sc29\20;
  78.      .\sc128\.\sc128\.\sc128\process video display based on ins_flag, cap_flag and num_flag\sc128\.\sc128\.\sc128\.
  79.      .\sc128\.\sc128\.\sc128\process the ASCII and scan code for ``key_code''.\sc128\.\sc128\.
  80. goto top;
  81.  
  82. Example 2: Pseudocode
  83. 
  84.